package Program.Tool;

import javax.swing.*;
import java.awt.*;

public class PictureAlterJPanel extends JPanel {
    private String path;

    public PictureAlterJPanel(String path){
        super(null);
        this.path = path;
    }

    //等比例显示图片
    @Override
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);
        ImageIcon icon = new ImageIcon(path);
        g.drawImage(icon.getImage(), 0, 0, getWidth(), getHeight(), icon.getImageObserver());
    }
}
